package com.spzx.product.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.spzx.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.util.List;

/**
 * <p>
 * 商品分类
 * </p>
 *
 * @author Haoran Sun
 * @since 2024-07-15
 */
@EqualsAndHashCode(callSuper = true)
@TableName("category")
@Schema(description = "商品分类")
@Data
public class Category extends BaseEntity {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "分类名称")
    @TableField("name")
    private String name;

    @TableField("image_url")
    @Schema(description = "分类图片url")
    private String imageUrl;

    @Schema(description = "父分类id")
    @TableField("parent_id")
    private Long parentId;

    @Schema(description ="是否显示[0-不显示，1显示]")
    @TableField("status")
    private Byte status;

    @Schema(description = "排序")
    @TableField("order_num")
    private Integer orderNum;
    /**
     * 是否有子节点
     */
    @TableField(exist = false)
    private Boolean hasChildren;
    /**
     * 子节点集合
     */
    @TableField(exist = false)
    private List<Category> children;
}
